<?php
/**
 * Amazon报告配置
 * (amazon-model)
 */
namespace App\Models\Amazon;

use Illuminate\Database\Eloquent\Model;
class AmazonReportCondition extends Model
{
    protected $connection = 'mysql_amazon';

    protected $table = 'amazon_report_condition';

    protected $guarded  = [];

    public static function getStartTime($reportType){
        $re = self::query()->where('report_type',$reportType)->value('start_time');
        return $re ?: '';
    }

    public static function upStartTime($reportType,$nextTime){
        $obj = self::query()->where('report_type',$reportType)->first();
        $obj->start_time = date('Y-m-d H:i:s',strtotime($nextTime));
        $obj->save();
    }

}
